from idaapi import *
import idc
import string

#main call
if __name__=='__main__':
    Wait()
    file = idc.ARGV[1]
    api = idc.ARGV[2]
    if not file:
        print("Cancel storing path information!\n")
    else: 
        with open(file,'w') as fd:
            for f in Functions():
                if not f is None:
                    fname = Name(f) #get function name
                    if fname==api:
                    	for ref in CodeRefsTo(f, 1):
                        	fd.write("%s\n" % GetFunctionName(ref))
        fd.close()
	Exit(0)




